﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DbFactory.Base
{
    public class BaseModel
    {
        /// <summary>
        /// 
        /// </summary>
        public string id { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string create_user_name { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string create_user { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public DateTime create_time { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string modification_user { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string modification_user_name { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public DateTime modification_time { get; set; }

        public void Create(string userId, string userName)
        {
            this.id=Guid.NewGuid().ToString();
            this.create_user = userId;
            this.create_user_name = userName ?? userId;
            this.create_time = DateTime.Now;
            this.modification_user = userId;
            this.modification_user_name = userName ?? userId;
            this.modification_time = DateTime.Now;
        }


        public void Modify(string userId, string userName)
        {
            this.modification_user = userId;
            this.modification_user_name = userName ?? userId;
            this.modification_time = DateTime.Now;
        }


    }

}
